package com.shuai.model.converter;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.shuai.model.loginInfo.UserDetailInfo;
import com.shuai.model.po.SysUser;

/**
 * 用户详细信息转换器
 *
 * @author shuai.zhao
 * @since 2022
 */
public class UserDetailInfoConverter {
    /**
     * 对象ByLoginUser转换器
     * @param source
     * @return
     */
    public static UserDetailInfo convertToUserDetailInfoByPo(SysUser source) {
        if(ObjectUtil.isNull(source)){
            return null;
        }
        UserDetailInfo target = new UserDetailInfo();
        BeanUtil.copyProperties(source, target);
        return target;
    }

    /**
     * 默认0为true,1为false
     * @param source
     * @return
     */
    public static boolean isBooleanForVal(Integer source) {
        return (0 == source) ? true : false;
    }
}